<?php
use app\Tools\UrlTool;
use app\Tools\StaticTool;
// 引入Js文件
StaticTool::registerJs('admin/role.js', app\assets\LayuiAsset::className());
?>
<fieldset class="layui-elem-field layui-field-title">
    <legend>角色管理 - 设置权限</legend>
</fieldset>
<form class="layui-form" action="">
    <input type="hidden" name="role_id" value="<?=$roleId?>">

    <div class="layui-form-item">
        <label class="layui-form-label">角色名称</label>
        <div class="layui-input-block">
            <input type="text" name="" lay-verify="title" class="layui-input" disabled value="<?=$roleInfo['name']?>">
        </div>
    </div>

    <?php if (!empty($accessList)): ?>
    <div class="layui-form-item">
        <label class="layui-form-label">功能列表</label>
        <div class="layui-input-block">
            <?php foreach ($accessList as $access): ?>
            <input type="checkbox" name="access_ids[]" title="<?=$access['title']?>" lay-skin="primary" value="<?=$access['id']?>"
                   <?php if (in_array($access['id'], $selectAccessIds)): ?>checked<?php endif; ?>
            ><br>
            <?php endforeach; ?>
        </div>
    </div>
    <?php else: ?>

    <?php endif; ?>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="button" class="layui-btn layui-btn-sm" id="btn-submit-access">立即提交</button>
            <a class="layui-btn layui-btn-sm" href="<?= UrlTool::createUrl('/admin/role') ?>">返回</a>
        </div>
    </div>
</form>